package cn.felord.verse.controller;

import cn.felord.common.kogito.dmn.DmnApplicationContext;
import cn.felord.security.autoconfigure.annotation.Anonymous;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dax
 * @since 2023/12/30
 */
@RestController
@RequestMapping("/test")
public class RefreshController {
    @Autowired
    private DmnApplicationContext dmnApplicationContext;

    @Anonymous
    @GetMapping
    public ResponseEntity<?> refresh() {
        dmnApplicationContext.refreshApplication();
        return ResponseEntity.ok("refresh success");
    }
}
